package com.lwm.controller;

import com.lwm.factory.SingletonBeanFactory;
import com.lwm.service.IAccountService;

/**
 * @author liweimin
 * @date 2021/6/2 17:10
 * @since
 */
public class SingletonBeanTest {
    public static void main(String[] args) {
        IAccountService accountService = (IAccountService) SingletonBeanFactory.getBean("accountService");
        IAccountService accountService1 = (IAccountService) SingletonBeanFactory.getBean("accountService");

        accountService.saveAccount();

        System.out.println("accountService 哈希值:" + accountService.hashCode());
        System.out.println("accountService1 哈希值:" + accountService1.hashCode());
        System.out.println(accountService == accountService1);
    }
}
